//引入路由对象
import {createRouter, createWebHistory} from 'vue-router'
import type {RouteRecordRaw} from "vue-router";
// 路由类型 RouteRecordRaw
// 定义一些路由
// 每个路由都需要映射到一个组件。
const routes: Array<RouteRecordRaw> = [{
    path: '/',
    name: 'home',
    component: () => import('../views/home/home.vue'),  /* 路由懒加载 */
}, {
    path: '/about',
    name: 'about',
    component: () => import('../views/about/about.vue'),
},{
    path: '/list',
    name: 'list',
    component: () => import('../views/home/list.vue'),
},{
    path: '/date_rate',
    name: 'date_rate',
    component: () => import('../views/home/date_rate.vue'),
}]

/* 路由模式 
  createWebHistory: h5
  createWebHashHistory: HASH
  createMemoryHistory: 服务端渲染时
*/

const router = createRouter({
    history: createWebHistory(),
    routes
})

//导出router
export default router
